package testy;


import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Random;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeriesCollection;

@SuppressWarnings("serial")
@WebServlet("/hello")
public class Hello extends HttpServlet 
{
	@Override
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{
		
	}
	
	private Temperatur temperatures = new Temperatur (true);
	private LevelOfIllumination levelOfIllumination = new LevelOfIllumination (true);

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{
//		for (int i = 0; i < 25; i++)
//		{
//			String tempInside = request.getParameter ("t" + i);
//			String tempOutside = request.getParameter ("to" + i);
//			String illumination = request.getParameter ("i" + i);
//			
//			temperatures.addTemperaturInside (i, tempInside);
//			temperatures.addTemperaturOutside (i, tempOutside);
//			levelOfIllumination.addLevel (i, illumination);
//		}

		//System.out.println ("test");
		

		PrintWriter w = response.getWriter();
		
		String title = request.getParameter ("population");
		
		response.setContentType("text/html");
		
		w.write(title);
		
		//Test t = new Test();
		//JFreeChart chart = t.getChart();
		
		//OutputStream out = response.getOutputStream();
		
		//response.setContentType("image/png");
		
		//JFreeChart chart = Simulation.calculate();				
		
		//ChartUtilities.writeChartAsPNG(out, chart, 500, 500);
		
	}
}
